#include<bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int T, n, a[N];
long long sum;
int main () {
    freopen("color.in", "r", stdin);
    freopen("color.out", "w", stdout);
    scanf("%d", &T);
    while (T--) {
        scanf("%d", &n);
        sum = 0;
        memset(a, 0, sizeof(a));
        for (int i = 1, x; i <= n; i++) {
            cin >> x;
            a[x]++;
        }
        for (int i = 1; i <= N; i++) if (a[i] % 2 == 0) sum += 1ll * i * (a[i] / 2);
        printf("%lld\n", sum);
    }
    return 0;
}
